package com.create404.suishoupai.controller;


import com.create404.suishoupai.dto.DepartmentDto;
import com.create404.suishoupai.entity.Department;
import com.create404.suishoupai.service.IDepartmentService;
import com.create404.suishoupai.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author create404
 * @since 2021-07-17
 */
@Api(tags = "部门接口")
@RestController
@RequestMapping("/department")
public class DepartmentController {
    @Autowired
    private IDepartmentService iDepartmentService;


    @ApiOperation(value = "获取记录列表")
    @GetMapping("/getDepartmentPerson")
    public Result getDepartmentPerson() {
        List<Department> departmentList = iDepartmentService.getDepartmentAndPerson();
        return Result.ok(departmentList, "获取记录列表成功");
    }

    @GetMapping("/getDepartment")
    public Result getDepartment() {
        List<DepartmentDto> departmentList = iDepartmentService.selectAll();
        return Result.ok(departmentList, "获取记录列表成功");
    }

}
